% styles/mypackages.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{styles/mypackages}[2025/10/23 Custom package settings for LaTeX project]

% 基本包
\RequirePackage[utf8]{inputenc}
\RequirePackage{graphicx}
\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{amssymb}
\RequirePackage{hyperref}
\RequirePackage{xcolor}
\RequirePackage{geometry}
\RequirePackage{setspace}
\RequirePackage{booktabs}   % 专业表格
\RequirePackage{caption}    % 图表标题
\RequirePackage{subcaption} % 子图
\RequirePackage{enumitem}   % 增强列表控制
\RequirePackage{listings}   % 代码列表
\RequirePackage{longtable}  % 长表格
\RequirePackage{float}      % 浮动体控制
\RequirePackage{tabularx}    % 自适应页面宽度，避免表格超宽
\RequirePackage[T1]{fontenc} % 添加字体编码支持

% 页面布局设置
\geometry{
    a4paper,
    left=2.5cm, 
    right=2.5cm, 
    top=2.5cm, 
    bottom=2.5cm,
    headheight=14.5pt
}

% 行间距设置
\setstretch{1.2}

% 超链接设置
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=cyan,
    citecolor=green,
    pdftitle={国产开源数据库调研与测试报告},
    pdfauthor={cmx-cxd},
    bookmarksnumbered=true,
    bookmarksopen=true
}

% 图表设置
\captionsetup{font=small, labelfont=bf}
\captionsetup[table]{position=top}
\captionsetup[figure]{position=bottom}

% 列表设置
\setlist[enumerate]{label=(\arabic*), leftmargin=*}
\setlist[itemize]{leftmargin=*}

% 代码列表设置
\lstset{
    basicstyle=\ttfamily\footnotesize,
    breaklines=true,
    breakatwhitespace=true,
    frame=single,
    numbers=left,
    numberstyle=\tiny\color{gray},
    keywordstyle=\color{blue},
    commentstyle=\color{green!60!black},
    stringstyle=\color{red},
    showstringspaces=false,
    tabsize=4,
    upquote=true,
    columns=flexible,
    % 添加更多语言特定的关键字
    morekeywords={version, services, image, container_name, network_mode, volumes, environment, ports, restart, healthcheck, test, interval, timeout, retries, build, context, dockerfile, networks}
}

% 定义 YAML 语言样式（用于 docker-compose）
\lstdefinelanguage{yaml}{
    keywords={true,false,null,y,n},
    keywordstyle=\color{blue},
    basicstyle=\ttfamily\footnotesize,
    sensitive=false,
    comment=[l]{\#},
    commentstyle=\color{gray}\ttfamily,
    stringstyle=\color{red},
    morestring=[b]',
    morestring=[b]"
}

% 定义 Dockerfile 语言样式
\lstdefinelanguage{dockerfile}{
    keywords={FROM, RUN, COPY, ADD, WORKDIR, EXPOSE, ENV, ARG, USER, VOLUME, CMD, ENTRYPOINT, LABEL},
    keywordstyle=\color{blue},
    basicstyle=\ttfamily\footnotesize,
    sensitive=false,
    comment=[l]{\#},
    commentstyle=\color{gray}\ttfamily,
    stringstyle=\color{red}
}

% 定义 Properties 文件样式
\lstdefinelanguage{properties}{
    keywords={},
    keywordstyle=\color{blue},
    basicstyle=\ttfamily\footnotesize,
    sensitive=false,
    comment=[l]{\#},
    commentstyle=\color{gray}\ttfamily,
    stringstyle=\color{red},
    morestring=[b]"
}